/*
 * logon_sessmgr.h
 *
 *  Created on: Dec 16, 2013
 *      Author: killerg
 */

#ifndef LOGIN_SESSMGR_H_
#define LOGIN_SESSMGR_H_

#include "share/la_msg.pb.h"
#include "share/session_mgr.h"

struct logon_session_t {
    tran_s* _trans;
    int64_t _sessid;
    double _idle_timer;

    logon_session_t(int64_t sessid_, tran_s* trans):
        _trans(trans), _sessid(sessid_), _idle_timer(1000.0f) {
    }

    void update();
    void on_connect();
    void on_disconnect();

    bool send_msg(la::AMsg* &msg);
};

struct logonsess_mgr_t : public svr_session_t<logon_session_t, la::LMsg, la::LMsgID_ARRAYSIZE, la::AMsg, la::AMsgID_ARRAYSIZE> {
    typedef svr_session_t<logon_session_t, la::LMsg, la::LMsgID_ARRAYSIZE, la::AMsg, la::AMsgID_ARRAYSIZE> base;
    bool init();
};



#endif /* LOGIN_SESSMGR_H_ */
